﻿using B.S.DataBase.SuYuan.Domains.Entites;
using B.S.DataBase.SuYuan.ErrorCode;
using B.S.DataBase.SuYuan.Read.API.Applications.Commands.Shop;
using B.S.DataBase.SuYuan.Read.API.Dtos;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.DataBase.SuYuan.Read.API.Controllers
{
    /// <summary>
    /// api-读
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ManageController : ControllerBase
    {
        private readonly IMediator mediator;

        public ManageController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 查询商品类型
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<List<ShopTypeModel>>> GetShopType([FromQuery]ShopTypeQueryCommand command )
        {
            return mediator.Send(command);  
        }

        /// <summary>
        /// 查询商品基本信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIPaning<ShopInfoDto>> GetShopInfo([FromQuery] ShopInfoQueryCommand command)
        {
            return mediator.Send(command);
        }

        /// <summary>
        /// 反填商品基本信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<List<ShopInfoDto>>> GetFanShop([FromQuery] ShopFanQueryCommand command)
        {
            return mediator.Send(command);
        }








    }
}
